package top.xierongsheng.user.validate.impl;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import top.xierongsheng.user.validate.ValidParam;

public class ParamValidator implements ConstraintValidator<ValidParam, String> {

    /**
     * 初始化
     *
     * @param constraintAnnotation
     */
    @Override
    public void initialize(ValidParam constraintAnnotation) {
    }

    @Override
    public boolean isValid(String param, ConstraintValidatorContext constraintValidatorContext) {

        System.out.print(constraintValidatorContext.getClockProvider());
        System.out.print(constraintValidatorContext.getDefaultConstraintMessageTemplate());
        if (param == null) {
            return true;
        }
        return false;
    }
}
